/*************************************************
 * 
 * Copyright by Bruno Eberhard
 * 
 * Created on 01.08.2005
 *
 *************************************************/
package fightplan.business;

import java.io.Serializable;

public enum CategoryType implements Comparable<CategoryType>, Serializable {
	KATA("Kata"), KUMITE("Kumite"), TEAM_KATA("Team Kata"), TEAM_KUMITE("Team Kumite"), SPECIAL("Spezial"), UNSET(
			"Unbekannt"), ALL("Alle");

	private static final long serialVersionUID = 1;

	public static final CategoryType[] ALL_VALUES = new CategoryType[] { KATA, KUMITE, TEAM_KATA, TEAM_KUMITE, SPECIAL,
			UNSET, ALL };
	public static final CategoryType[] VALUES = new CategoryType[] { KATA, KUMITE, TEAM_KATA, TEAM_KUMITE, SPECIAL };
	public static final CategoryType[] VALUES_AND_UNSET = new CategoryType[] { UNSET, KATA, KUMITE, TEAM_KATA,
			TEAM_KUMITE, SPECIAL };
	public static final CategoryType[] VALUES_AND_ALL = new CategoryType[] { ALL, KATA, KUMITE, TEAM_KATA, TEAM_KUMITE,
			SPECIAL };

	private String name;

	CategoryType(String name) {
		this.name = name;
	}

	// get / set

	public String getName() {
		return name;
	}

	public boolean isTeam() {
		return TEAM_KATA.equals(this) || TEAM_KUMITE.equals(this);
	}

	public boolean isKumite() {
		return KUMITE.equals(this) || TEAM_KUMITE.equals(this);
	}

	public static CategoryType parseType(String typeString) {
		for (CategoryType type : VALUES) {
			if (type.getName().equalsIgnoreCase(typeString)) {
				return type;
			}
		}
		return null;
	}

}